import React, { lazy } from 'react'
import { Redirect } from 'react-router-dom'

const MXDiscover = lazy(() => import('pages/discover'))
const MXRecommend = lazy(() => import('pages/discover/c-pages/recommend'))
const MXRanking = lazy(() => import('pages/discover/c-pages/ranking'))
const MXSongs = lazy(() => import('pages/discover/c-pages/songs'))
const MXDjRadio = lazy(() => import('pages/discover/c-pages/djradio'))
const MXArtist = lazy(() => import('pages/discover/c-pages/artist'))
const MXAlbum = lazy(() => import('pages/discover/c-pages/album'))
const MXPlayer = lazy(() => import('pages/player'))

const MXFriends = lazy(() => import('pages/friends'))
const MXMine = lazy(() => import('pages/mine'))

// import MXDiscover from 'pages/discover'
// import MXRecommend from 'pages/discover/c-pages/recommend'
// import MXRanking from 'pages/discover/c-pages/ranking'
// import MXSongs from 'pages/discover/c-pages/songs'
// import MXDjRadio from 'pages/discover/c-pages/djradio'
// import MXArtist from 'pages/discover/c-pages/artist'
// import MXAlbum from 'pages/discover/c-pages/album'
// import MXPlayer from 'pages/player'

// import MXFriends from 'pages/friends'
// import MXMine from 'pages/mine'

const routes = [
  {
    path: '/',
    exact: true,
    render: () => (
      <Redirect to="/discover"/>
    )
  },
  {
    path: '/discover',
    component: MXDiscover,
    routes: [
      {
        path: "/discover",
        exact: true,
        render: () => (
          <Redirect to={"/discover/recommend"}/>
        )
      },
      {
        path: "/discover/recommend",
        component: MXRecommend
      },
      {
        path: "/discover/ranking",
        component: MXRanking
      },
      {
        path: "/discover/songs",
        component: MXSongs
      },
      {
        path: "/discover/djradio",
        exact: true,
        component: MXDjRadio
      },
      {
        path: "/discover/artist",
        component: MXArtist
      },
      {
        path: "/discover/album",
        component: MXAlbum
      },
      {
        path: "/discover/player",
        component: MXPlayer
      }
    ]
  },
  {
    path: '/mine',
    component: MXMine
  },
  {
    path: '/friend',
    component: MXFriends
  }
]

export default routes